package com.zj.config;

import com.zj.web.bean.ResponseResult;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * spring mvc 的controller类  全局异常处理类
 */
@ControllerAdvice
public class GlobalExceptionHandle {
    @ExceptionHandler(Exception.class)
    public ResponseEntity<ResponseResult> handleAllException(Exception e) {
        //自定义异常处理逻辑
        return new ResponseEntity<>(ResponseResult.error("文件上传模块致命错误"+e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
    }

}
